<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>后台管理系统--登录</title>
<link rel="stylesheet" href="/backend/css/style.default.css" type="text/css" />

<script type="text/javascript" src="/backend/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="/backend/js/jquery-migrate-1.1.1.min.js"></script>
<script type="text/javascript" src="/backend/js/jquery-ui-1.9.2.min.js"></script>
<script type="text/javascript" src="/backend/js/modernizr.min.js"></script>
<script type="text/javascript" src="/backend/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/backend/js/jquery.cookie.js"></script>
<script type="text/javascript" src="/backend/js/custom.js"></script>

<body class="loginpage">

<div class="loginpanel">
    <div class="loginpanelinner">
        <div class="logo animate0 bounceIn"><img src="/backend/images/logo.png" alt="" /></div>
        <form id="login">
            <div class="inputwrapper login-alert">
                <div class="alert alert-error">用户名或密码不正确!</div>
            </div>
            <div class="inputwrapper animate1 bounceIn">
                <input type="text" name="admin_name" id="admin_name" placeholder="请输入帐号" />
            </div>
            <div class="inputwrapper animate2 bounceIn">
                <input type="password" name="login_password" id="login_password" placeholder="请输入密码" />
            </div>
            <div class="inputwrapper animate3 bounceIn">
                <a name="submit" id="loginSubmit" class="btn btn-success">登录</a>
            </div>
            <div class="inputwrapper animate4 bounceIn">
                <label><input type="checkbox" class="remember" name="signin" /> 保持登录</label>
            </div>
            
        </form>
    </div><!--loginpanelinner-->
</div><!--loginpanel-->

<div class="loginfooter">
    <p>&copy; 2017. Admin . All Rights Reserved.</p>
</div>

</body>
</html>
<script>
    var url = "<?php echo url('login');?>";
    var jumpUrl = "<?php echo url('base/Index/index');?>";
    jQuery('#loginSubmit').click(function(){
            var formData = jQuery("#login").serialize();//序列化表格内容为字符串
            jQuery.ajax({
                type: 'POST',
                url: url,
                data: formData ,
                dataType: 'JSON',
                success: function(res){
                    console.log(res);
                    if(res.code == 0)
                    {
                        window.location.href=jumpUrl;
                    }
                    else
                    {
                        jQuery('.login-alert').fadeIn();
                        window.setTimeout(function(){
                            jQuery('.login-alert').fadeOut();
                        },2000);
                        return false;
                    }
                }
            })
        }
    );
</script>
